#[macro_export]
macro_rules! log {
    ($($color:ident)* =>  $title:expr, $($arg:tt)*) => {{
        let __msg = format!($($arg)*);
        let mut __title = ::console::style($title);
        $(
            __title = __title.$color();
        )*
        println!("{} {}", __title, __msg);
    }};

}

#[macro_export]
macro_rules! color {
    ($color:ident => $display:expr) => {{
        ::console::style($display).$color()
    }};

    ($($color:ident)* => $display:expr) => {{
        let mut __style = ::console::style($display);
        $(__style = __style.$color();)*
        __style
    }};

    ($color:ident => $($arg:tt)*) => {{
        ::console::style(format!($($arg)*)).$color()
    }};

    ($($color:ident)* => $($arg:tt)*) => {{
        let mut __style = ::console::style(format!($($arg)*));
        $(__style = __style.$color();)*
        __style
    }};
}

#[macro_export]
macro_rules! error {
    ($($arg:tt)*) => {
        $crate::log!(red bold => "ERR", $($arg)*)
    };
}

#[macro_export]
macro_rules! exit {
    ($($arg:tt)*) => {{
        $crate::log!(red bold => "EXIT", $($arg)*);
        println!("");
        fn __error()  { ::std::process::exit(0); }
        __error();
    }};
}

#[macro_export]
macro_rules! tip {
    ($($arg:tt)*) => {
        $crate::log!(cyan bold blink=> "TIP", $($arg)*)
    };
}

#[macro_export]
macro_rules! why {
    ($($arg:tt)*) => {
        $crate::log!(bold cyan=> "WHY", $($arg)*)
    };
}

#[macro_export]
macro_rules! debug {
    ($($arg:tt)*) => {
        $crate::log!(bright red bold blink=> "DEBUG", $($arg)*)
    };
}
